<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * Short description for file
 *
 * PHP version 5.3.+
 *
 * @category   
 * @package    
 * @author     Marius Schmidt <marius.schmidt@gridground.de>
 * @copyright  2010-2012 Gridground UG (haftungsbeschränkt)
 * @license    http://www.gridground.de/license/brickscout.txt
 * @version    GIT: $Id$
 * @link       
 * @see        
 * @since      File available since 
 */

/**
 * Short description for class
 *
 * @category   
 * @package    
 * @author     Marius Schmidt <marius.schmidt@gridground.de>
 * @copyright  2010-2012 Gridground UG (haftungsbeschränkt)
 * @license    http://www.gridground.de/license/brickscout.txt
 * @version    Release: @package_version@
 * @link       
 * @see        
 * @since      Class available since Release 
 */
class Economic_GetDataCommand implements Economic_RemoteCommand {
    
    private $_mediator;
    private $_entity;
    
    public function __construct(Economic_RemoteCommandMediator $mediator, Economic_Entity $entity) {
        $this->_mediator = $mediator;
        $this->_entity = $entity;
    }
    
    public function execute() {
        $result = $this->_mediator->soapCall($this->getFunctionName(), $this->getParams());
        $key = $this->_entity->getEconomicObjectClassName() . '_GetDataResult';
        return $result->$key;
    }
    
    public function getFunctionName() {
        return $this->_entity->getEconomicObjectClassName() . '_GetData';
    }
    
    public function getParams() {
        return array(
            'entityHandle' => $this->_entity,
        );
    }
    
}
